[Staking] Consolidate try state warnings#11649
Merged
Conversation
Contributor
Author
|
New consolidated try state warnings |
rockbmb
approved these changes
Apr 6, 2026
sigurpol
reviewed
Apr 7, 2026
sigurpol
approved these changes
Apr 7, 2026
andreitrand
reviewed
Apr 7, 2026
| const MAX_EXAMPLES: usize = 10; | ||
|
|
||
| BondedPools::<T>::iter().try_for_each(|(id, inner)| -> Result<(), TryRuntimeError> { | ||
| total_pools += 1; |
Contributor
There was a problem hiding this comment.
Nit: total_pools simply equals BondedPools::<T>::count(), so I suggest simply setting it to this value before the iteration rather than incrementing it by 1 (for extra clarity).
andreitrand
reviewed
Apr 7, 2026
| const MAX_EXAMPLES: usize = 10; | ||
|
|
||
| BondedPools::<T>::iter_keys().for_each(|id| { | ||
| total_pools += 1; |
Contributor
There was a problem hiding this comment.
Nit: Same as above: I suggest setting total_pools directly to BondedPools::<T>::count() before the loop.
Contributor
Author
There was a problem hiding this comment.
No strong opinions but I don't think it matters much. We are looping anyways.
andreitrand
reviewed
Apr 7, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resolves #11646